package cn.iocoder.yudao.module.pay.order.vo;

import cn.iocoder.yudao.framework.common.validation.InEnum;
import cn.iocoder.yudao.module.api.pay.order.eums.UnifiedOrderStatusEnum;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.NotEmpty;
import jakarta.validation.constraints.NotNull;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;

import java.time.LocalDateTime;

import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;

@Schema(description = "付款单据 Response VO")
@Data
public class PayOrderSimpleRespVO {

    @Schema(description = "唯一编号", requiredMode = Schema.RequiredMode.REQUIRED)
    private Long id;

    @Schema(description = "支付单号", requiredMode = Schema.RequiredMode.REQUIRED, example = "PAY202412011838591")
    @NotNull(message = "支付单号不能为空")
    private String no;

    @Schema(description = "商户交易单号", requiredMode = Schema.RequiredMode.REQUIRED, example = "SHP2024111116038888")
    @NotNull(message = "商户交易单号不能为空")
    private String tradeNo;

    @Schema(description = "支付金额，单位：分", requiredMode = Schema.RequiredMode.REQUIRED, example = "10")
    @NotNull(message = "支付金额，单位：分不能为空")
    private Long price;

    @Schema(description = "支付渠道：alipay_app、wx_lite、wallet", requiredMode = Schema.RequiredMode.REQUIRED, example = "wallet")
    @NotEmpty(message = "支付渠道不能为空")
    private String channelCode;

    @Schema(description = "支付状态：0-待付款、10-已付款、20-已退款、30-已关闭", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
    @NotNull(message = "支付状态不能为空")
    @InEnum(UnifiedOrderStatusEnum.class)
    private Integer status;

    @Schema(description = "用户 IP", requiredMode = Schema.RequiredMode.REQUIRED, example = "127.0.0.1")
    @NotNull(message = "用户 IP不能为空")
    private String userIp;

    @Schema(description = "订单失效时间", requiredMode = Schema.RequiredMode.REQUIRED)
    @NotNull(message = "订单失效时间不能为空")
    @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
    private LocalDateTime expireTime;

    @Schema(description = "订单支付成功时间")
    @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
    private LocalDateTime successTime;

    @Schema(description = "退款总金额，单位：分", requiredMode = Schema.RequiredMode.REQUIRED, example = "10")
    @NotNull(message = "退款总金额，单位：分不能为空")
    private Long refundPrice;

    @Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED)
    private LocalDateTime createTime;

}
